package stark.app.function.g2048;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.stark.game2048.lib.Def2048GameActivity;
import com.stark.game2048.lib.bean.G2048OpenInfo;
import com.stark.game2048.lib.constant.G2048OpenProvider;

import org.jetbrains.annotations.NotNull;

import stark.app.R;
import stark.app.databinding.ActivityOpenModeSelBinding;
import stark.common.basic.base.BaseNoModelActivity;

/**
 * Author：daizhongbin on 2023/1/4
 * Email：1027154338@qq.com
 * Desc:
 */
public class OpenModeSelActivity extends BaseNoModelActivity<ActivityOpenModeSelBinding> {

    @Override
    protected int onCreate() {
        return R.layout.activity_open_mode_sel;
    }

    @Override
    protected void initView() {
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        mDataBinding.rvOpenMode.setLayoutManager(layoutManager);
        OpenModeAdapter modeAdapter = new OpenModeAdapter();
        modeAdapter.setNewInstance(G2048OpenProvider.getOpenInfos());
        modeAdapter.setOnItemClickListener(this);
        mDataBinding.rvOpenMode.setAdapter(modeAdapter);
    }

    @Override
    protected void initData() {
    }

    @Override
    protected void onItemClickCallback(@NonNull @NotNull BaseQuickAdapter<?, ?> adapter, @NonNull @NotNull View view, int position) {
        Def2048GameActivity.start(this, (G2048OpenInfo) adapter.getItem(position));
    }
}
